package com.bwie.service;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bwie.dao.ArticleDao;
import com.bwie.entity.Article;
import com.bwie.entity.Category;
import com.bwie.entity.QueryVo;
import com.bwie.entity.Channel;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@Service
public class ArticleServiceImpl implements ArticleService {
    
	@Autowired
	private ArticleDao articleDao;
	
	@Override
	public PageInfo<Article> list(Integer pageNum, QueryVo qv) {
		// TODO Auto-generated method stub
		PageHelper.startPage(pageNum, 3);
		List<Article> list = articleDao.list(qv);
		return new PageInfo<>(list);
	}

	@Override
	public List<Channel> getAllChannerl(){
		// TODO Auto-generated method stub
		return articleDao.getAllChannerl();
	}

	@Override
	public List<Category> getCategory(Integer cid) {
		// TODO Auto-generated method stub
		return articleDao.getCategory(cid);
	}

	@Override
	public void add(Article a) {
		// TODO Auto-generated method stub
		articleDao.add(a);
	}

}
